	function OnSubmitForm()
{
		var stillError = 0;
	
		if(document.pressed == "Add Resident"){					
			
			//validate Student Number			
			if ( checkStudentNumber(document.adminform.student_number.value)== false) stillError++;
			if ( checkFirstName(document.adminform.first_name.value)== false) stillError++;
			if ( checkMiddleName(document.adminform.middle_name.value)== false) stillError++;
			if ( checkLastName(document.adminform.last_name.value)== false) stillError++;						
			if ( checkBirthday(document.adminform.birthday.value)== false) stillError++;						
			if ( checkReligion(document.adminform.religion.value)== false) stillError++;
			if ( checkCourse(document.adminform.course.value)== false) stillError++;
			if ( checkHomeAddress(document.adminform.home_address.value)== false) stillError++;
			if ( checkTelephoneNumber(document.adminform.telephone_number.value, "telephone_number")== false) stillError++;
			if ( checkEmailAddress(document.adminform.email_address.value)== false) stillError++;
			if ( checkFatherName(document.adminform.name_of_father.value)== false) stillError++;
			if ( checkMotherName(document.adminform.name_of_mother.value)== false) stillError++;
			if ( checkGuardianName(document.adminform.name_of_guardian.value)== false) stillError++;						
			if ( checkFatherContactNumber(document.adminform.telnumber_of_father.value)== false) stillError++;						
			if ( checkMotherContactNumber(document.adminform.telnumber_of_mother.value)== false) stillError++;						
			if ( checkGuardianContactNumber(document.adminform.telnumber_of_guardian.value)== false) stillError++;		

			document.adminform.action ="addResident";
			if(stillError > 0)
			{
			    displayDickHead();
				return false;					
			}else{
				return true;				
			}
		}else if(document.pressed == "Main Menu"){
			document.adminform.action ="loadAdminPageView";
			return true;
		}
}
